<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        body {
            margin: 4px
        }

        .container {
            column-gap: 0;
            column-count: 4; 
        }

        .item {
            padding: 2px;
            position: relative;
            counter-increment: item-idx;
            box-sizing: border-box;
        }
        .item img{
            display: block;
            width: 100%;
            height: auto;
        }
        .item::after{
            width: 24px;
            height: 24px;
            line-height: 24px;
            text-align: center;
            color: #fff;
            background-color: #000;
            display: block;
            position: absolute;
            left: 2px;
            top: 2px;
            content: counter(item-idx)
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="item">
            <img src="https://picsum.photos/360/460?random=1" alt="">
        </div>
        <div class="item">
            <img src="https://picsum.photos/360/500?random=1" alt="">
        </div>
        <div class="item">
            <img src="https://picsum.photos/360/480?random=1" alt="">
        </div>
        <div class="item">
            <img src="https://picsum.photos/360/400?random=1" alt="">
        </div>
        <div class="item">
            <img src="https://picsum.photos/360/520?random=1" alt="">
        </div>
        <div class="item">
            <img src="https://picsum.photos/360/420?random=1" alt="">
        </div>
        <div class="item">
            <img src="https://picsum.photos/360/490?random=1" alt="">
        </div>
        <div class="item">
            <img src="https://picsum.photos/360/550?random=1" alt="">
        </div>
        <div class="item">
            <img src="https://picsum.photos/360/460?random=1" alt="">
        </div>
        <div class="item">
            <img src="https://picsum.photos/360/440?random=1" alt="">
        </div>
    </div>
</body>

</html>